# print("work")

import os
file_size = 0

def dir_size(dir_name):
    global file_size
    file_list = os.listdir(dir_name)
    print(file_list)
    for file in file_list:
        file_path=os.path.join(dir_name, file)
        print(dir_name)
        if os.path.isfile(file_path):
            size = os.path.getsize(file_path)
            print(size)
            file_size += size
        else:
            dir_size(file_list)
dir_size
print('_' * 50)
print('文件目录路径：')
print('_' * 50)
dir_size('/Users/liguang/Downloads/个人文件/【数据分析训练营】/【1】Excel/阶段一模块一讲义与数据')
print('_' * 50)
print('文件夹大小' , file_size , '字节')
print('_' * 50)